package com.barber.service;

import com.barber.mapper.AdminMapper;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AdminServiceImpl implements AdminService {
    Logger logger=Logger.getLogger(AdminServiceImpl.class);
    @Autowired
    AdminMapper adminMapper;
    @Override
    public Map alogin(Map map) {
        logger.debug(map);

//        Map result= sqlSessionFactory.openSession().selectOne("com.lx.mapper.SellerMapper.select",map);
        Map result= (Map) adminMapper.getOne(map);
        logger.debug(result);
        return result;
    }

//    @Override
//    public List getMenu(Map map) {
//        logger.debug(map);
//
////                List l= sqlSessionFactory.openSession().selectList("com.eat.mapper.MenuMapper.select", map);
//        List l=adminMapper.getList(map);
//        logger.debug(l);
//        return l;
//    }

    @Override
    public boolean update(Map map) {
        logger.debug(map);
        Boolean b=adminMapper.update(map);
        logger.debug(b);

        return b;
    }

    @Override
    public Map password(Map map) {
        logger.debug(map);//{fpemail=2966123846@qq.com}

//                List l= sqlSessionFactory.openSession().selectList("com.eat.mapper.MenuMapper.select", map);
        Map pass= (Map) adminMapper.getList(map);
        map.putAll(pass);
        logger.debug(map);
        return map;
    }

    @Override
    public Map getinfo(Map map) {
        logger.debug(map);

//        Map result= sqlSessionFactory.openSession().selectOne("com.lx.mapper.SellerMapper.select",map);
        Map b= adminMapper.getOne(map);
        logger.debug(b);
        return b;
    }
}
